﻿using Business.BookManagement.Dto;
using Business.BookManagement;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp;
using Business.PurchManagement;
using Business.PurchManagement.Dto;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/purch")]
    public class PurchController : AbpController
    {
        private readonly IPurchAppService _BookAppService;

        public PurchController(IPurchAppService PurchAppService)
        {
            _BookAppService = PurchAppService;
        }

        [HttpPost]
        [Route("data-post")]
        public Task<PurchDto> CreateOrUpdate(CreateOrUpdatePurchDto input)
        {
            return _BookAppService.CreateOrUpdate(input);
        }

        [HttpPost]
        [Route("post")]
        public Task<PurchDto> CreateOrUpdates(CreateOrUpdatePurchDto input)
        {
            return _BookAppService.CreateOrUpdates(input);
        }

        [HttpPost]
        [Route("delete")]
        public Task Delete(List<Guid> ids)
        {
            return _BookAppService.Delete(ids);
        }

        [HttpGet]
        [Route("{id}")]
        public Task<PurchDto> Get(Guid id)
        {
            return _BookAppService.Get(id);
        }

        [HttpGet]
        public Task<PagedResultDto<PurchDto>> GetAll(GetPurchInputDto input)
        {
            return _BookAppService.GetAll(input);
        }
        /// <summary>
        /// 连表查询显示
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("getAlls")]
        public  Task<PagedResultDto<PurchDto>> GetAlls(GetPurchInputDto input)
        {
            return  _BookAppService.GetAlls(input);
        }
        /// <summary>
        /// 连表查询显示（三表）
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("getAllse")]
        public async Task<PagedResultDto<AllInfo>> GetAllse(GetPurchInputDto input)
        {
            return await _BookAppService.GetAllse(input);
        }
    }
}
